#ifndef TFT_LCD_H
#define TFT_LCD_H
#include "bsp.h"

struct _s_lcd
{
	uint16_t LCD_HS_CNT;
	uint16_t LCD_VS_CNT;
	uint16_t POINT_COLOR;
	uint16_t BACK_COLOR;
	uint8_t(*Init)(void); 
	void (*DrawPoint)(uint16_t x,uint16_t y,uint16_t color);
	uint16_t (*GetPoint)(uint16_t x,uint16_t y);
	void (*DrawLine)(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2,uint16_t color);
	void (*Draw_Circle)(uint16_t syear,uint8_t smon,uint8_t sday,uint8_t hour,uint8_t min,uint8_t sec);
	void (*ShowNum)(uint16_t x,uint16_t y,uint32_t num,uint8_t len,uint8_t size);
	void (*ShowxNum)(uint16_t x,uint16_t y,uint32_t num,uint8_t len,uint8_t size,uint8_t mode);
	void (*ShowString)(uint16_t x,uint16_t y,uint16_t width,uint16_t height,uint8_t size,uint8_t *p);
	void (*DrawBMP)(uint16_t x,uint16_t y,uint16_t width,uint16_t height,uint16_t *p);
	void (*Fill)(uint16_t x,uint16_t y,uint16_t width,uint16_t height,uint16_t color);
};
extern struct _s_lcd lcd;

void LCD_DrawLine(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2,uint16_t color);
void LCD_DrawRectangle(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2,uint16_t color);
void LCD_Draw_Circle(uint16_t x0,uint16_t y0,uint8_t r);
void LCD_ShowNum(uint16_t x,uint16_t y,uint32_t num,uint8_t len,uint8_t size);
void LCD_ShowChar(uint16_t x,uint16_t y,uint8_t num,uint8_t size,uint8_t mode);
void LCD_ShowxNum(uint16_t x,uint16_t y,uint32_t num,uint8_t len,uint8_t size,uint8_t mode);
void LCD_ShowString(uint16_t x,uint16_t y,uint16_t width,uint16_t height,uint8_t size,uint8_t *p);
//void LCD_DrawBMP(uint16_t x,uint16_t y,uint16_t width,uint16_t height,uint16_t *p);
void LCD_Fill(uint16_t x,uint16_t y,uint16_t width,uint16_t height,uint16_t color);
void GUI_HZ(uint16_t x, uint16_t y, uint8_t c,uint16_t Color, uint16_t bkColor);
void GUI_HZ24(uint16_t x, uint16_t y, uint8_t c,uint16_t Color, uint16_t bkColor);

void GUI_SZ(uint16_t x, uint16_t y, uint8_t c,uint16_t Color, uint16_t bkColor);

void GUI_SZ16(uint16_t x, uint16_t y, uint8_t c,uint16_t Color, uint16_t bkColor);

void GUI_SZ24(uint16_t x, uint16_t y, uint8_t c,uint16_t Color, uint16_t bkColor);

void GUI_SZ32(uint16_t x, uint16_t y, uint8_t c,uint16_t Color, uint16_t bkColor);
void GUI_JT(uint16_t x, uint16_t y, uint8_t c,uint16_t Color, uint16_t bkColor);
void GUI_Rectangle(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1,uint16_t color,uint8_t fill);
void GUI_HZ32(uint16_t x, uint16_t y, uint8_t c,uint16_t Color, uint16_t bkColor);
void GUI_Text(uint16_t x, uint16_t y, uint8_t *str, uint16_t len,uint16_t Color, uint16_t bkColor);

void lcd_printf(const char *fmt, ...);

//GUI颜色
#define RGB565(RGB) (((( RGB>>19)&0x1f)<<11) + (((RGB>>10)&0x3f)<<5) + ((RGB>>3)&0x1f))
#define DARKBLUE      	 0XCF	//深蓝色
#define LIGHTBLUE      	 0X7C	//浅蓝色  
#define GRAYBLUE       	 0X58 //灰蓝色
//以上三色为PANEL的颜色 
 
#define LIGHTGREEN     	 0X1F //浅绿色
//#define LIGHTGRAY      0XEF5B //浅灰色(PANNEL)
#define LGRAY 			     0X18 //浅灰色(PANNEL),窗体背景色

#define LGRAYBLUE        0X51 //浅灰蓝色(中间层颜色)
#define LBBLUE           0X12 //浅棕蓝色(选择条目的反色)

/* definitions of color */
#define LCD_COLOR_WHITE          0xFFFF
#define LCD_COLOR_BLACK          0x0000
#define LCD_COLOR_GREY           0xF7DE
#define LCD_COLOR_BLUE           0x001F
#define LCD_COLOR_BLUE2          0x051F
#define LCD_COLOR_RED            0xF800
#define LCD_COLOR_MAGENTA        0xF81F
#define LCD_COLOR_GREEN          0x07E0
#define LCD_COLOR_CYAN           0x7FFF
#define LCD_COLOR_YELLOW         0xFFE0
#define LCD_COLOR_GBLUE          0X7497

#endif //TFT_LCD_H
